#include <func.h>
void *threadfunc(void *p)
{
    printf("I am subthread!\n");
    char *buf=(char*)calloc(20,sizeof(char));
    strcpy(buf,"hello");
    printf("%s\n",buf);
    pthread_exit(buf);
}
int main(int argc,char *argv[])
{
    int ret;
    pthread_t pthid;
    ret=pthread_create(&pthid,NULL,threadfunc,NULL);
    THREAD_ERROR_CHECK(ret,"pthread_create");
    printf("I am main thread\n");
    usleep(900);
    char* buu;
    pthread_join(pthid,(void**)(&buu));
    printf("Subthread's return: %s\n",buu);
    free(buu);
    return 0;
}

